﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SES.CMS.BL;
using SES.CMS.DAL;
using SES.CMS.DO;
using System.Data;
namespace SES.CMS.Module
{
    public partial class ucModuleLeftCate : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            { rptModuleLeftCateDataSource(); }
        }
        protected void rptModuleLeftCateDataSource()
        {
            DataTable dtLeftModule = new cmsArticleBL().BindToModuleHomepage(2, 5);
            if (dtLeftModule.Rows.Count > 0)
            {
                rptModuleLefCate.DataSource = new DataView(dtLeftModule,"STT = 1","",DataViewRowState.CurrentRows);
                rptModuleLefCate.DataBind();
                rptOtherRightCate.DataSource = new DataView(dtLeftModule,"STT > 1","",DataViewRowState.CurrentRows);
                rptOtherRightCate.DataBind();
            }
        }

        protected string FriendlyUrl(string s)
        {
            return Ultility.Change_AV(s);
        }

        public string FriendlyUrl2(string s)
        {
            return Ultility.Change_AV2(s);
        }

        public string CategoryTitle(string CategoryID)
        {
            string CategoryTitle = "";
            CategoryTitle = FriendlyUrl2(new cmsCategoryBL().Select(new cmsCategoryDO { CategoryID = int.Parse(CategoryID) }).Title);
            return CategoryTitle;
        }
    }
}